網際內容管理系統在精密機械教學與研究上的應用

  • Home
    • Site Map
    • reveal
    • blog
  • About
  • 主機設定
    • Windows 10
      • Win 網站簽章
      • Win Oauth2
      • Oauth2 原理
      • Nginx
    • Ubuntu設定
      • Ubuntu 簽章
      • 配置 uwsgi
      • xrdp
  • fossiloauth
    • foauth_config
  • fossilapp
  • Fossil
  • 專題報告
  • Reference
    • Flutter
      • Flutter ref
    • discourse
      • 操作管理
    • cd2020pj1
      • Oauth2
    • Network
    • Ref
      • LaTeX
      • Automatic Control
      • 參考步驟
      • ebook1
      • Project
      • Ref2
      • Bond Graphs
      • KMOLBrowser
      • Glowscript
      • Rapydscript
      • Atoms
      • Samples
      • RLearning
      • Ebooks
      • Feedback
      • CMSiMDE
      • Git
      • Windows
      • Ubuntu
      • Heorku
      • Certbot
Windows 10 << Previous Next >> Win Oauth2

Win 網站簽章

Letsencrypt

由於先前利用 Stunnel 啟動的 https 所使用的 localhost.crt 與 localhost.key 為 self-signed, 使用者在連線至 https://pj2022.kmol.info 時必須接受此一數位簽章的 public key, 瀏覽器與伺服器之間才能進行資料編碼傳送.

若能透過 Let's Encrypt 網站所提供的第三方公證數位簽章, 將經過對網站符號名稱公開認證的數位簽章檔案提供給 Stunnel, 此簽章的 public key 就會存在公開的 key server 上, 使用者瀏覽 https://pj2022.kmol.info 時就可以直接從 public key server 取得 domain name 編碼用的資料, 進而直接以 https 協定連線.

以下即要說明如何透過 https://certbot.eff.org/ 申請網站符號名稱的正式 https 數位簽章.

在 Windows 10 安裝 Nginx: 

https://nginx.org/en/docs/windows.html

透過 https://certbot.eff.org/lets-encrypt/windows-nginx 所提供的流程申請數位簽章.

由於先安裝 Nginx 全球資訊網伺服器之後, 再安裝 certbot 套件後, 就可以直接透過 www 伺服器驗證網站的符號名稱, 因此取得公證數位簽章的第一步是安裝 Nginx, 而安裝 Nginx 的另外一個用處是, 之後可以利用 html redirect 的方式, 將 http 連線跳轉到 https.

由於 pj2022.kmol.info 伺服器只有設定 IPv6 網址, 因此在設定 Nginx 的時候, 必須注意是否啟動 listen IPv6 網路協定封包. 其中 listen [::]:80 指的就是接受 IPv6 封包, 而 listen :80 就只能接受 IPv4 封包. 另外就是 server_name 設定為 pj2022.kmo.info, 應該就可以啟動 Nginx, 之後則可以再利用 Nssm 將 Nginx 設為服務啟動.

至於 html redirect 的語法:

<html>
<head>
<meta http-equiv="refresh" content="0; URL=https://pj2022.kmol.info" />
</head>
</html>

確定利用 Nginx 所設定的 http://pj2022.kmol.info 運作正常後, 就可以安裝 https://dl.eff.org/certbot-beta-installer-win32.exe, 然後在具管理者身份的命令列中執行:

certbot certonly --webroot

提供必要資訊後就可以在 c:\certbot 目錄中取得對應的 private key (privkey.pem) 與 public key (fullchain.pem). 之後再將 stunnel.conf 中的 localhost.key 與 localhost.crt 換成公證的數位簽章 keys 如下:

; TLS front-end to a web server
[https]
accept  = pj2022.kmol.info:443
connect = 9000
cert = fullchain.pem
key = privkey.pem
TIMEOUTclose = 0

然後再重新啟動 stunnel_fossil_flask 服務即可正式完成 https://pj2022.kmol.info 的設定.


Windows 10 << Previous Next >> Win Oauth2

Copyright © All rights reserved | This template is made with by Colorlib